/************************************************************************
 * @file ConfigPanelManager.h
 * @author Ian Chen
 * @version 1.0
 *
 * @section LICENSE
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 3 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
 * General Public License for more details at
 * http://www.gnu.org/licenses/lgpl.html
 *
 ************************************************************************/
#ifndef CONFIGPANELMANAGER_H
#define CONFIGPANELMANAGER_H

#include <pluginui/pluginui_global.h>

#include <vector>
using namespace std;

#include <QIcon>
#include <QObject>
#include <QString>
#include <pluginui/widget/ConfigPanel.h>

namespace antu
{
namespace plugin
{
namespace ui
{

typedef struct ConfigPanelItem
{
    QIcon icon;
    QString title;
    ConfigPanel* pPanel;

    ConfigPanelItem()
    {
        pPanel = nullptr;
    }

    inline bool isNull()
    {
        return (icon.isNull() ||
                pPanel == nullptr ||
                title.isEmpty());
    }
} ConfigPanelItemStruct;

class PLUGINUISHARED_EXPORT ConfigPanelManager : public QObject
{
    Q_OBJECT

public:
    ConfigPanelManager();
    ~ConfigPanelManager();

    size_t size() const;
    ConfigPanelItemStruct at(size_t index);
    inline bool isEmpty()
    {
        return this->size() == 0;
    }

    void addItem(ConfigPanelItem& item);
    void addItem(const QIcon& icon, const QString& title, ConfigPanel* pPanel);

private:
    vector<ConfigPanelItemStruct> m_oItems;

public:
    static const char* Name;
};
}
}
}


#endif // CONFIGPANELMANAGER_H
